// emoji占用两个字符,所以要用Array.from来将字符串转一下,不然会识别不出来
// http://www.alloyteam.com/2016/12/javascript-has-a-unicode-sinkhole/
export const emojis = Array.from(
  '🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐸🐵🐔🐧🐦🐤🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐞🐜🦟🦗🕷🦂🐢🐍🦎🦖🦕🐙🦑🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🐊🐅🐆🦓🦍🦧🐘🦛🦏🐪🐫🦒🦘🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐕‍🦺🐈🐓🦃🦚🦜🦢🦩🕊🐇🦝🦨🦡🦦🦥🐁🐀🐿🦔🐉🐲',
);

function getDays(s) {
  var arr = s.split('-');
  var d1 = new Date(arr[0], 0, 0).getTime();
  var d2 = new Date(arr[0], arr[1] - 1, arr[2]).getTime();
  var d = Math.floor((d2 - d1) / (1000 * 60 * 60 * 24));
  return d;
}

export default () => {
  const dayNumber = getDays(new Date().toISOString().replace(/(T.*)$/, ''));
  return emojis[dayNumber % emojis.length];
};
